Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[patch] Re-submit #867: Custom function - new field "cellValueType" for input cell value type information #895

Merged
merged 9 commits into from
Oct 9, 2024

Conversation

MiaofeiWang
Copy link

This is a duplicate of PR#867 as the original branch is not able to get update.


Change Description:

Cell value types have been introduced to custom function input parameter type. We decided to move it to a new attribute "cellValueType" for backward compatibility, so that older client won't break on unknown types.
"cellValueType" works as follows:
When "type" is one of "boolean"/"number"/"string", "cellValueType" won't be parsed by Excel. When "type" is "any" and "cellValueType" is a valid cell value type, the cell value type will be used as custom function parameter type. If "cellValueType" is invalid, Excel will use the fallback "type" "any".

Sample function metadata before change:

{
    "description": "Test Excel.CellValue parameter",
    "id": "TESTCELLVALUEPARAM",
    "name": "TESTCELLVALUEPARAM",
    "parameters": [
        {
        "name": "x",
        "type": "cellvalue"
        }
    ],
    "result": {}
}

after change:

{
    "description": "Test Excel.CellValue parameter",
    "id": "TESTCELLVALUEPARAM",
    "name": "TESTCELLVALUEPARAM",
    "parameters": [
        {
        "name": "x",
        "type": "any"
        "cellValueType": "cellvalue"
        }
    ],
    "result": {}
}
  1. Do these changes impact command syntax of any of the packages? (e.g., add/remove command, add/remove a command parameter, or update required parameters)
    No

  2. Do these changes impact documentation? (e.g., a tutorial on https://learn.microsoft.com/office/dev/add-ins/overview/office-add-ins)
    Cell value types are not public yet.

  3. Validation/testing performed:
    Updated and ran tests.

@MiaofeiWang MiaofeiWang requested a review from a team as a code owner October 9, 2024 02:11
Copy link
Contributor

@akrantz akrantz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK. Suggest seeing if @ts-ignore can be removed, but that doesn't block check-in.

@@ -708,6 +722,13 @@ function getParameters(parameterItem: IGetParametersArguments): IFunctionParamet
type: ptype,
};

// for backward compatibility, we put cell value type in cellValueType instead of type.
if (Object.values(CELLVALUETYPE_MAPPINGS).includes(ptype)) {
// @ts-ignore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to not have @ts-ignore here. Usually the code could be modified. Can you please look into this?

@akrantz akrantz requested a review from a team October 9, 2024 18:30
@millerds
Copy link
Contributor

millerds commented Oct 9, 2024

/azurepipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@millerds millerds merged commit c2087a0 into OfficeDev:master Oct 9, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants